<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<!--view层-->
<div id="app">
  <h1>{{message}}</h1>
  <h2>{{lastname+" "+firstname}}</h2>
  <h2>{{lastname}} {{firstname}}</h2>
  <h1>推荐简洁写法</h1>
  <h2>{{getFullName()}}</h2>
  <h1>以上操作也可以这样写:计算属性</h1>
  <h2>{{fullName}}</h2>

</div>
<!--viewModel层-->
<script src="../../js/vue.js"></script>
<!--model层-->
<script>
  const app = new Vue({
    el: '#app',
    data: {
      message: '计算属性:很重要的使用',
      lastname: '张',
      firstname: '小明'
    }, computed: {
      //计算属性:这里一般也是函数(表面是属性的方式),其实是函数的语法糖
      fullName:function () {
        return this.lastname + " " + this.firstname
      }
    }, methods: {
      getFullName: function () {
        //声明方法
        return this.lastname + " " + this.firstname
      }
    }, created: function () {
      //生命周期
    }, mounted: function () {
      //生命周期
    }
  })
</script>
</body>
</html>